/**
 * @(#) DesignPatternComponent.java
 */

package cn.edu.sjtu.se.dslab.component.design;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import cn.edu.sjtu.se.dslab.component.Component;
import cn.edu.sjtu.se.dslab.component.design.DesignPatternInstance;
import cn.edu.sjtu.se.dslab.project.Project;

@Entity
@Table(name = "design_pattern_component")
public class DesignPatternComponent extends Component {

	private static final long serialVersionUID = 529207292814720947L;

	private DesignPatternInstance instance;
	private String xmlPath;
	private Project project;
	
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "instance", nullable = false)
	public DesignPatternInstance getInstance() {
		return instance;
	}

	public void setInstance(DesignPatternInstance instance) {
		this.instance = instance;
	}

	@Column(nullable = false, name = "xml_path")
	public String getXmlPath() {
		return xmlPath;
	}

	public void setXmlPath(String xmlPath) {
		this.xmlPath = xmlPath;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@JoinColumn(name = "project_id")
	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	
}
